<?php
    echo '<select id="'.$option_id.'" name="'.$option_id.'">';

    $default='';
    if (isset($option_select)) $default = $option_select;
        
    foreach($container as $d )
    {                                                                     
        if ($d->{$fieldname}== $default)
            echo "<option value=".$d->id." selected='selected'>".$d->{$fieldname}."</option>";
        else
            echo "<option value=".$d->id." >".$d->{$fieldname}."</option>";
    }     
                                       
    echo '</select>';  
    $button_id = 'btn_'.$option_id ;
    $newDialogID =  'new_'.$option_id.'_Dialog';
    $quickAddClick = "QuickAdd_onClick('".$option_id."','".$newDialogID."');";

    if (isset($DialogID)) 
    {
        $quickAddClick = "QuickAdd_onClick('".$option_id."','".$DialogID."');";
        echo '<button id="'.$button_id.'" type="button" onclick="'.$quickAddClick.'">'.getLangText('Quick Add',false).'</button>';        
        return;
    }
    else
       $quickAddClick = "QuickAdd_onClick('".$option_id."','".$newDialogID."');";
 
    
    echo '<button id="'.$button_id.'" type="button" onclick="'.$quickAddClick.'">'.getLangText('Quick Add',false).'</button>';
      
    echo '<div id="'.$newDialogID.'" class="adhocDialog" style="display:none;z-index:1000;">';

    echo '<div class="widget">';
    echo '<div class="wHeader">';
    echo '<div class="headerText">'. getLangText("Create new ".$caption,false).'</div>';
    echo '</div>';
    echo '<div class="wContent">';
       
    echo '<div style="font-size:15px;padding-left:10px;">'. getLangText($caption,false).':</div>';
    echo '<input type="text" id="input_'.$option_id.'" style="width:90%;margin-left:10px;" name="input_'.$option_id.'" size="100" value="" />';
    echo '<br/><br/>';
    echo '<button style="margin-left:10px;" onclick="addNew(\''.$option_id.'\');">'. getLangText("Add",false).'</button>';
    echo '<hr/><ul id="ul_'.$option_id.'"></ul></div>';
    echo '<div class="wFooter">';
    echo '<div class="saveChange" onclick="onSaveChange(\''.$option_id.'\');">'.getLangText("Save Changes",false).'</div>';
    echo '<div class="saveChange" onclick="closeDialog();">'.getLangText("Close",false).'</div>';  
    echo '</div></div></div>';
?>


